home *** CD-ROM | disk | FTP | other *** search
/ Garbo / Garbo.cdr / mac / hypercrd / hc2_x / tcprogud.sit / TC Prog Guide / card_57613.txt < prev    next >
Text File  |  1991-02-27  |  992b  |  25 lines

  1. -- card: 57613 from stack: in
  2. -- bmap block id: 0
  3. -- flags: 0000
  4. -- background id: 4755
  5. -- name: 
  6.  
  7.  
  8. -- part contents for background part 4
  9. ----- text -----
  10. FILE I/O
  11.  
  12. To read from and write to files, the appropriate stream should first be opened via the standard library function fopen(), whose prototype is:
  13.  
  14.     FILE   *fopen(char  *filename, char  *description);
  15.  
  16. The filename and description arguments specify the name of the file and how it will be used, such as "r" for reading a text stream and "w" for writing to a text stream.  The return value is a pointer to a FILE type: a data structure defined in stdio.h identifying the characteristics of the I/O device specified.
  17.  
  18. The fprintf() and fscanf() functions are very similar to printf() and scanf() except that their first argument is a FILE pointer:
  19.  
  20.     int   fprintf(FILE  *stream, char  *format_string, ...);
  21.     int   fscanf(FILE  *stream, char  *format_string, ...);
  22.  
  23. -- part contents for background part 7
  24. ----- text -----
  25. 191